import {
    detailPages
} from '@/api'
const state = {
    detailPagesInfo: {}
}
const mutations = {
    RESOVE_DETAILPAGESINFO(state, detailPagesInfo) {
        state.detailPagesInfo = detailPagesInfo
    }
}
const actions = {
    async getDetailPages({
        commit
    }, skuId) {
        const result = await detailPages(skuId)
        if (result.code === 200) {
            commit('RESOVE_DETAILPAGESINFO', result.data)
        }
    }
}
const getters = {
    categoryView(state) {
        return state.detailPagesInfo.categoryView || {}
    },
    spuSaleAttrList(state) {
        return state.detailPagesInfo.spuSaleAttrList || []
    },
    skuInfo(state) {
        return state.detailPagesInfo.skuInfo || []
    },
}
export default {
    state,
    mutations,
    actions,
    getters
}